<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="layout/blank"><!-- layout文件路径-->
<head>
    <title>编辑优惠券</title>
</head>
<body>
<div layout:fragment="content">
    <div class="content-frame">
        <div class="row">
            <div class="col-md-12">
                <form class="form-horizontal" id="couponForm">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title" th:if="${isEdit} eq 'add'">新增优惠券</h3>
                            <h3 class="panel-title" th:if="${isEdit} eq 'edit'">编辑优惠券</h3>
                            <ul class="panel-controls">
                                <li><a href="#" class="panel-remove"><span class="fa fa-times"></span></a></li>
                            </ul>
                        </div>

                        <div class="panel-body">

                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">名称</label>
                                <div class="col-md-6 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                        <input type="text" class="form-control" name="title" th:if="${isEdit} eq 'add'"/>
                                        <input type="text" class="form-control" name="title" th:value="${coupon.title}" th:if="${isEdit} eq 'edit'"/>
                                    </div>
                                    <span class="help-block">填写优惠券名称，必填</span>
                                </div>
                            </div>
                            <input type="hidden" name="id" th:if="${isEdit} eq 'add'"/>
                            <input type="hidden" name="id" th:value="${coupon.id}" th:if="${isEdit} eq 'edit'"/>

                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">coupon id</label>
                                <div class="col-md-6 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                        <input type="text" class="form-control" name="couponId"
                                               th:if="${isEdit} eq 'add'"/>
                                        <input type="text" class="form-control" name="couponId"
                                               th:value="${coupon.couponId}" th:if="${isEdit} eq 'edit'"/>
                                    </div>
                                    <span class="help-block">填写couponId，非必填</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">满额</label>
                                <div class="col-md-6 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-addon"><span class="fa fa-cny"></span></span>
                                        <input type="number" class="form-control" required name="withAmount" th:if="${isEdit} eq 'add'"/>
                                        <input type="number" class="form-control" required name="withAmount" th:value="${coupon.withAmount}" th:if="${isEdit} eq 'edit'"/>
                                    </div>
                                    <span class="help-block">满多少可以使用，必填</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">金额</label>
                                <div class="col-md-6 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-addon"><span class="fa fa-cny"></span></span>
                                        <input type="number" class="form-control" required name="usedAmount" th:if="${isEdit} eq 'add'"/>
                                        <input type="number" class="form-control" required name="usedAmount" th:value="${coupon.usedAmount}" th:if="${isEdit} eq 'edit'"/>
                                    </div>
                                    <span class="help-block">优惠券金额，必填</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">发行数量</label>
                                <div class="col-md-6 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                        <input type="number" class="form-control" required name="quota" th:if="${isEdit} eq 'add'"/>
                                        <input type="number" class="form-control" required name="quota" th:value="${coupon.quota}" th:if="${isEdit} eq 'edit'"/>
                                    </div>
                                    <span class="help-block">发行数量，必填</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">开始日期</label>
                                <div class="col-md-6 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-addon"><span class="fa fa-calendar"></span></span>
                                        <input type="text" class="form-control datepicker" name="validStartTime" th:if="${isEdit} eq 'add'">
                                        <input type="text" class="form-control datepicker" name="validStartTime" th:value="${coupon.validStartTime}" th:if="${isEdit} eq 'edit'">
                                    </div>
                                    <span class="help-block">什么时间开始可以使用</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">失效日期</label>
                                <div class="col-md-6 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-addon"><span class="fa fa-calendar"></span></span>
                                        <input type="text" class="form-control datepicker" name="validEndTime" th:if="${isEdit} eq 'add'">
                                        <input type="text" class="form-control datepicker" name="validEndTime" th:value="${coupon.validEndTime}" th:if="${isEdit} eq 'edit'">
                                    </div>
                                    <span class="help-block">什么时间失效</span>
                                </div>
                            </div>

                        </div>
                        <div class="panel-footer">
                            <a class="btn btn-primary pull-right" id="submit-coupon-form-btn">提交</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

</body>
</html>
